<template>
<!-- 溶栓 -->
    <div >
        <div class="header">
            <image :src="titleleftimg" class="header-left-img" @click="pageControl.finish()"/>
            <div class="header-center"><text class="header-text">溶栓</text></div>
            <div class="header-right" @click="pageControl.saveData" v-if="canSave"><text class="header-right-text">保存</text></div>
            <div class="header-right-s" v-if=" ! canSave"></div>
        </div>

        <div class="content">
            <div class="box">
                <div class="line">
                    <div class="title-max"><text class="box-text">溶栓开始知情同意:</text></div>
                    <div class="input" @click="pageControl.selectedDateTime(0,resData.DiagTreatModel.THROM_START_AGREE_TIME)">
                        <text class="input-text">{{resData.DiagTreatModel.THROM_START_AGREE_TIME | filterTime}}</text>
                        <image :src="imgUrl" class="img-unit"></image>
                    </div>
                </div>
                <div class="line">
                    <div class="title-max"><text class="box-text">溶栓签署知情同意:</text></div>
                    <div class="input" @click="pageControl.selectedDateTime(1,resData.DiagTreatModel.THROM_SIGN_AGREE_TIME)">
                        <text class="input-text">{{resData.DiagTreatModel.THROM_SIGN_AGREE_TIME | filterTime}}</text>
                        <image :src="imgUrl" class="img-unit"></image>
                    </div>
                </div>
            </div>
            <div class="box">
                <div class="line">
                    <div class="title-max"><text class="box-text">溶栓开始时间:</text></div>
                    <div class="input" @click="pageControl.selectedDateTime(2,resData.DiagTreatModel.THROM_START_TIME_DT)">
                        <text class="input-text">{{resData.DiagTreatModel.THROM_START_TIME_DT | filterTime}}</text>
                        <image :src="imgUrl" class="img-unit"></image>
                    </div>
                </div>
                <div class="line">
                    <div class="title-max"><text class="box-text">溶栓结束时间:</text></div>
                    <div class="input" @click="pageControl.selectedDateTime(3,resData.DiagTreatModel.THROM_END_TIME_DT)">
                        <text class="input-text">{{resData.DiagTreatModel.THROM_END_TIME_DT | filterTime}}</text>
                        <image :src="imgUrl" class="img-unit"></image>
                    </div>
                </div>
            </div>
            <div class="box">
                <div class="title-max"><text class="box-text">溶栓药物:</text></div>
                <div class="checkbox" :class="[resData.DiagTreatModel.THROM_DRUG_TYPE_DT==1?'checkbox-active':'']" @click="ISChecked('DiagTreatModel','THROM_DRUG_TYPE_DT',1)"><text class="checkbox-text" :class="[resData.DiagTreatModel.THROM_DRUG_TYPE_DT==1?'checkbox-text-active':'']">一代</text></div>
                <div class="checkbox mf-10" :class="[resData.DiagTreatModel.THROM_DRUG_TYPE_DT==2?'checkbox-active':'']" @click="ISChecked('DiagTreatModel','THROM_DRUG_TYPE_DT',2)"><text class="checkbox-text" :class="[resData.DiagTreatModel.THROM_DRUG_TYPE_DT==2?'checkbox-text-active':'']">二代</text></div>
                <div class="checkbox mf-10" :class="[resData.DiagTreatModel.THROM_DRUG_TYPE_DT==3?'checkbox-active':'']" @click="ISChecked('DiagTreatModel','THROM_DRUG_TYPE_DT',3)"><text class="checkbox-text" :class="[resData.DiagTreatModel.THROM_DRUG_TYPE_DT==3?'checkbox-text-active':'']">三代</text></div>
            </div>
            <div class="box">
                <div class="title-max"><text class="box-text">溶栓剂量:</text></div>
                <div class="checkbox":class="[resData.DiagTreatModel.THROM_DRUG_CODE_DT==1?'checkbox-active':'']" @click="ISChecked('DiagTreatModel','THROM_DRUG_CODE_DT',1)"><text class="checkbox-text" :class="[resData.DiagTreatModel.THROM_DRUG_CODE_DT==1?'checkbox-text-active':'']">全量</text></div>
                <div class="checkbox mf-10":class="[resData.DiagTreatModel.THROM_DRUG_CODE_DT==2?'checkbox-active':'']" @click="ISChecked('DiagTreatModel','THROM_DRUG_CODE_DT',2)"><text class="checkbox-text" :class="[resData.DiagTreatModel.THROM_DRUG_CODE_DT==2?'checkbox-text-active':'']">半量</text></div>
            </div>
            <div class="box">
                <div class="title-max"><text class="box-text">溶栓场所:</text></div>
                <div class="checkbox" :class="[resData.DiagTreatModel.DIAGNOSIS_UNIT_CODE_DT==1?'checkbox-active':'']" @click="ISChecked('DiagTreatModel','DIAGNOSIS_UNIT_CODE_DT',1)"><text class="checkbox-text" :class="[resData.DiagTreatModel.DIAGNOSIS_UNIT_CODE_DT==1?'checkbox-text-active':'']">其他医院</text></div>
                <div class="checkbox mf-10" :class="[resData.DiagTreatModel.DIAGNOSIS_UNIT_CODE_DT==2?'checkbox-active':'']" @click="ISChecked('DiagTreatModel','DIAGNOSIS_UNIT_CODE_DT',2)"><text class="checkbox-text" :class="[resData.DiagTreatModel.DIAGNOSIS_UNIT_CODE_DT==2?'checkbox-text-active':'']">救护车</text></div>
                <div class="checkbox mf-10" :class="[resData.DiagTreatModel.DIAGNOSIS_UNIT_CODE_DT==3?'checkbox-active':'']" @click="ISChecked('DiagTreatModel','DIAGNOSIS_UNIT_CODE_DT',3)"><text class="checkbox-text" :class="[resData.DiagTreatModel.DIAGNOSIS_UNIT_CODE_DT==3?'checkbox-text-active':'']">本院急诊科</text></div>
                <div class="checkbox mf-10" :class="[resData.DiagTreatModel.DIAGNOSIS_UNIT_CODE_DT==4?'checkbox-active':'']" @click="ISChecked('DiagTreatModel','DIAGNOSIS_UNIT_CODE_DT',4)"><text class="checkbox-text" :class="[resData.DiagTreatModel.DIAGNOSIS_UNIT_CODE_DT==4?'checkbox-text-active':'']">本院心内科</text></div>
            </div>
        </div>
    </div>
</template>
<script>
    import Resource from "../../../dist/res/Resource";
    import EMNewRSControl from "./EMNewRSControl";
    import DateUtil from "../../common/util/DateUtil"
    export default {
        name: 'EMNewMainEditInfo',
        data: function () {   
            return {
                titleleftimg:"title_cha_img.png",
                imgUrl:"choose.png",
                pageControl:"",
                currentTab:0,
                resData: {
                    DiagTreatModel: {
                        THROM_START_AGREE_TIME: '',
                        THROM_SIGN_AGREE_TIME: '',
                        THROM_START_TIME_DT: '',
                        THROM_END_TIME_DT: '',
                        THROM_DRUG_TYPE_DT: '',
                        THROM_DRUG_CODE_DT: '',
                        DIAGNOSIS_UNIT_CODE_DT: ''
                    }
                },
                canSave:true
            }         
                                            
        },
        methods: {
            ISChecked: function (model,key,value) {
                if(! this.canSave){
                    return
                }
                this.resData[model][key] = this.resData[model][key] && this.resData[model][key] === value  ? '' : value;
            }
        },
        filters: {
            filterTime: function(item) {
                if(item) {
                    let time = DateUtil.formatTime(item,'yyyy-MM-dd hh:mm')
                    return time
                }
            }
        },
        mounted:function () {
            let self = this;
            self.pageControl = new EMNewRSControl(self);
        }
    }
</script>
<style>
    .header {
        height: 40px;
        background-color: #FFF;
        display: flex;
        flex-direction: row;
        justify-content: space-between;    
        align-items: center;
        border-bottom-style: solid;
        border-bottom-width: 0.5px;
        border-bottom-color: #f2f2f2;
    }
    .header-left {
        margin-left: 20px;
    }
    .header-right {
        width: 80px;
        height: 25px;
        background-color: #4c7fd8;
        margin-right: 20px;  
        border-radius: 2px;     
    }
    .header-right-s {
        width: 80px;
        height: 25px;
        margin-right: 20px;
        border-radius: 2px;
    }
    .header-left-img {
        width: 30px;
        height: 30px;
        margin-left: 10px;
    }
    .header-text {
        font-size: 13px;
        color: #666;
    }
    .header-right-text {
        font-size: 13px;
        color: #FFF;
        text-align: center;
        line-height: 25px;       
    }
    .title_btn_list{
        display: flex;
        flex-direction: row;
        align-items: center;
        border-bottom-color: #f2f2f2;
        border-bottom-width: 0.5px;
        border-bottom-style: solid;
    }
    .content {
        padding-left: 40px;
        padding-right: 40px;
        padding-top: 20px;
        padding-bottom: 20px;
        box-sizing: border-box;
    }
    .box {
        flex: 1;
        display: flex;
        flex-direction: row;
        justify-content: flex-start;   
        height: 40px;
        align-items: center;
    }
    .box-textarea {
        flex: 1;
        display: flex;
        flex-direction: row;
        justify-content: flex-start;   
        height: 60px;    
        margin-top: 9px;   
    }   
    .box-text {
        font-size: 12px;
        color: #666;
    }
    .line {
        flex: 1;
        display: flex;
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
        box-sizing: border-box;
        margin-right: 70px;
    }
    .title-max {
        width: 120px;
    }   
    .input {
        position: relative;
        flex: 1;
        box-sizing: border-box;
        padding-left: 8px;
        height: 25px;       
        border-radius: 5px;
        border-style: solid;
        border-width: 1px;
        border-color: #b1b1b1;
    }
    .input-text {  
        color: #666;
        line-height: 22px;     
        font-size: 12px;
    }    
    .checkbox {
        width: 87px;
        height: 25px;
        background-color: #f2f2f2;
        border-radius: 3px;        
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .checkbox-active {
        background-color: #4c7fd8;
    }
    .checkbox-text {
        font-size: 12px;
        color: #666;
    }
    .checkbox-text-active {
        color: #FFF;
    }
    .mf-10 {
        margin-left: 10px;
    }    
    .img-unit {
        position: absolute;                  
        top: 3px;
        right: 8px;
        width: 10px;
        height: 19px;
    }
    .tab {
        width: 80px;
        height: 30px;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content:center;
        margin-left: 5px;
        margin-right: 5px;
        border-bottom-style: solid;
        border-bottom-width: 0;
        border-bottom-color: #FFF;
    }
    .tab-active {
        border-bottom-style: solid;
        border-bottom-width: 1px;
        border-bottom-color: #4c7fd8;
    }
    .tab-text{
        text-align: center;
        font-size: 12px;
        color: #666;
    }
</style>

